const util = {
  TYPE_ARRAY: "[object Array]",
  TYPE_OBJECT: "[object Object]",
  _typeOf(value){
    return Object.prototype.toString.call(value)
  },
  _deepClone(obj){
    return JSON.parse(JSON.stringify(obj))
  },
  _isEmptyObject(obj){
    if(util._typeOf(obj) !== util.TYPE_OBJECT) throw new Error(`传入值不是对象！`);
    for(let key in  obj){
      return false;
    }
    return true
  },
  _isObjEqual(o1,o2){
    var props1 = Object.getOwnPropertyNames(o1);
    var props2 = Object.getOwnPropertyNames(o2);
    if (props1.length != props2.length) {
      return false;
    }
    for (var i = 0,max = props1.length; i < max; i++) {
      var propName = props1[i];
      if (o1[propName] !== o2[propName]) {
        return false;
      }
    }
    return true;
  }
}
module.exports = util;